#include <asm.h>
#include <regdef.h>
#include <inst_test.h>

LEAF(n14_lw_test)
    .set noreorder
    addiu s0, s0 ,1
    li  s2, 0x0
###test inst
    TEST_LW(0xc822c7e8, 0x800d34c0,  0x66a8,  0x66a8, 0xc822c7e8)
    TEST_LW(0x71737c10, 0x800df660,  0x02e4,  0x02e4, 0x71737c10)
    TEST_LW(0x03682420, 0x800d24e4,  0x1680,  0x1680, 0x03682420)
    TEST_LW(0x6f59f5d3, 0x800dabdc,  0x01b0,  0x01b0, 0x6f59f5d3)
    TEST_LW(0x56d90696, 0x800d28b4,  0x1cf4,  0x1cf4, 0x56d90696)
    TEST_LW(0xeda52048, 0x800d4ea8,  0x2db0,  0x2db0, 0xeda52048)
    TEST_LW(0x383e8970, 0x800d8ae4,  0x6d88,  0x6d88, 0x383e8970)
    TEST_LW(0x28c90aca, 0x800d3840, -0x4fa8, -0x4fa8, 0x28c90aca)
    TEST_LW(0x54aca118, 0x800d06c0, -0x581c, -0x581c, 0x54aca118)
    TEST_LW(0x909e34d2, 0x800d37c0, -0x5734, -0x5734, 0x909e34d2)
    TEST_LW(0xc4b1feb0, 0x800d0cf8,  0x1288,  0x1288, 0xc4b1feb0)
    TEST_LW(0xcb6cd8c0, 0x800d6db8,  0x2050,  0x2050, 0xcb6cd8c0)
    TEST_LW(0x66394aee, 0x800d522c, -0x6b1c, -0x6b1c, 0x66394aee)
    TEST_LW(0x48d355e4, 0x800d6b90,  0x4af0,  0x4af0, 0x48d355e4)
    TEST_LW(0x1bb40b48, 0x800d2e6c, -0x6598, -0x6598, 0x1bb40b48)
    TEST_LW(0x2a748b22, 0x800d7160, -0x7e10, -0x7e10, 0x2a748b22)
    TEST_LW(0xd5cfb394, 0x800d7f00,  0x0514,  0x0514, 0xd5cfb394)
    TEST_LW(0x72445ce0, 0x800d59e4, -0x60ec, -0x60ec, 0x72445ce0)
    TEST_LW(0xc01702ce, 0x800d02d8,  0x7cd4,  0x7cd4, 0xc01702ce)
    TEST_LW(0xa616d1be, 0x800d07f0,  0x0ac4,  0x0ac4, 0xa616d1be)
    TEST_LW(0xf1456d95, 0x800d7754,  0x1358,  0x1358, 0xf1456d95)
    TEST_LW(0xb98a0778, 0x800d1a74,  0x3408,  0x3408, 0xb98a0778)
    TEST_LW(0x76852c0e, 0x800d788c,  0x0dfc,  0x0dfc, 0x76852c0e)
    TEST_LW(0x3a4e6338, 0x800d0000, -0x1458, -0x1458, 0x3a4e6338)
    TEST_LW(0x8625f42c, 0x800d0000, -0x0540, -0x0540, 0x8625f42c)
    TEST_LW(0x16240da0, 0x800d0000, -0x013c, -0x013c, 0x16240da0)
    TEST_LW(0x325a52cc, 0x800d0000,  0x1310,  0x1310, 0x325a52cc)
    TEST_LW(0x848cbadf, 0x800d0000,  0x0828,  0x0828, 0x848cbadf)
    TEST_LW(0x95696380, 0x800d0000, -0x19e0, -0x19e0, 0x95696380)
    TEST_LW(0xcf5f7ec0, 0x800d0000, -0x2974, -0x2974, 0xcf5f7ec0)
    TEST_LW(0x82ae70d0, 0x800d0000,  0x2524,  0x2524, 0x82ae70d0)
    TEST_LW(0xc354a660, 0x800d0000,  0x6cf0,  0x6cf0, 0xc354a660)
    TEST_LW(0x66a38db4, 0x800d0000,  0x2530,  0x2530, 0x66a38db4)
    TEST_LW(0x13649030, 0x800d0000,  0x5bc4,  0x5bc4, 0x13649030)
    TEST_LW(0xb7f66e24, 0x800d0000,  0x28b0,  0x28b0, 0xb7f66e24)
    TEST_LW(0xc268a414, 0x800d0000,  0x59c0,  0x59c0, 0xc268a414)
    TEST_LW(0x102044e3, 0x800d0000,  0x3d0c,  0x3d0c, 0x102044e3)
    TEST_LW(0xff0f205f, 0x800d0000,  0x7be0,  0x7be0, 0xff0f205f)
    TEST_LW(0xe394e882, 0x800d0000,  0x3f00,  0x3f00, 0xe394e882)
    TEST_LW(0x6b53ef5a, 0x800d0000,  0x31d0,  0x31d0, 0x6b53ef5a)
    TEST_LW(0xd3ad5b32, 0x800d0000, -0x2790, -0x2790, 0xd3ad5b32)
    TEST_LW(0x0e61fb40, 0x800d0000, -0x761c, -0x761c, 0x0e61fb40)
    TEST_LW(0xcb58118c, 0x800d0000, -0x5ed0, -0x5ed0, 0xcb58118c)
    TEST_LW(0xe56fb3a8, 0x800d0000,  0x72ec,  0x72ec, 0xe56fb3a8)
    TEST_LW(0x6661617c, 0x800d0000,  0x4650,  0x4650, 0x6661617c)
    TEST_LW(0x5f7c08b0, 0x800d0000, -0x7adc, -0x7adc, 0x5f7c08b0)
    TEST_LW(0x2b1ea090, 0x800d0000,  0x0000,  0x0000, 0x2b1ea090)
    TEST_LW(0xe4a9ee00, 0x800d0000,  0x0000,  0x0000, 0xe4a9ee00)
    TEST_LW(0x6472d096, 0x800d0000,  0x0000,  0x0000, 0x6472d096)
    TEST_LW(0xc60dfd1c, 0x800d0000,  0x0000,  0x0000, 0xc60dfd1c)
    TEST_LW(0xaaa54652, 0x800d0000,  0x0000,  0x0000, 0xaaa54652)
    TEST_LW(0xfd47929c, 0x800d0000,  0x0000,  0x0000, 0xfd47929c)
    TEST_LW(0xe40e0b9e, 0x800d0000,  0x0000,  0x0000, 0xe40e0b9e)
    TEST_LW(0x6bcb55b4, 0x800d0000,  0x0000,  0x0000, 0x6bcb55b4)
    TEST_LW(0xe6cb2590, 0x800d0000,  0x0000,  0x0000, 0xe6cb2590)
    TEST_LW(0x3d911cb8, 0x800d0000,  0x0000,  0x0000, 0x3d911cb8)
    TEST_LW(0xe65874bd, 0x800d0000,  0x0000,  0x0000, 0xe65874bd)
    TEST_LW(0x3a3c9edc, 0x800d0000,  0x0000,  0x0000, 0x3a3c9edc)
    TEST_LW(0xbddd406e, 0x800d0000,  0x0000,  0x0000, 0xbddd406e)
    TEST_LW(0xfe6fb690, 0x800d0000,  0x0000,  0x0000, 0xfe6fb690)
    TEST_LW(0x941bc8b2, 0x800d0000,  0x0000,  0x0000, 0x941bc8b2)
    TEST_LW(0x9393289c, 0x800d0000,  0x0000,  0x0000, 0x9393289c)
    TEST_LW(0x29b2c02d, 0x800d0000,  0x0000,  0x0000, 0x29b2c02d)
    TEST_LW(0x00000000, 0x800d0000,  0x0000,  0x0000, 0x00000000)
###detect exception
    bne s2, zero, inst_error
    nop
###score ++
    addiu s3, s3, 1
###output (s0<<24)|s3
inst_error:  
    sll t1, s0, 24
    NOP4
    or t0, t1, s3 
    NOP4
    sw t0, 0(s1)
    jr ra
    nop
END(n14_lw_test)
